# -*- coding:utf-8 -*-

from server.action.batchBase import batchBase
from server.util import sqlBuild, stringUtil
import uuid


class lcdd(batchBase):  # 掉电
    @batchBase.idChecked
    def action(self, data, d):
        lcId = data[2]

        sql = sqlBuild.sqlDict["insert_fault"]
        sql += "(" + lcId + ",3)"
        self.db.insert(sql)

        data = "警告：路灯[%s]，发生断电事故，请及时处理！" % lcId
        self.re.publish('faultMessage', data)

        d.callback((2,))
